package com.lincoln.jenkins.test;

public class Utils {
    public static String removeAtStr(String content) {
        while (content.indexOf("@") != -1) {

        }
        return null;
    }

    public static int str2num(String str, int defaultValue) {
        Integer res = null;
        try {
            res = Integer.parseInt(str);
        } catch (Exception e) {
            res = null;
        }
        if (res == null) {
            switch (str) {
                case "零":
                    res = 0;
                    break;
                case "一":
                    res = 1;
                    break;
                case "二":
                    res = 2;
                    break;
                case "三":
                    res = 3;
                    break;
                case "四":
                    res = 4;
                    break;
                case "五":
                    res = 5;
                    break;
                case "六":
                    res = 6;
                    break;
                case "七":
                    res = 7;
                    break;
                case "八":
                    res = 8;
                    break;
                case "九":
                    res = 9;
                    break;
                case "十":
                    res = 10;
                    break;
                case "十一":
                    res = 11;
                    break;
                case "十二":
                    res = 12;
                    break;
                case "十三":
                    res = 13;
                    break;
                case "十四":
                    res = 14;
                    break;
                case "十五":
                    res = 15;
                    break;
                case "十六":
                    res = 16;
                    break;
                case "十七":
                    res = 17;
                    break;
                case "十八":
                    res = 18;
                    break;
                case "十九":
                    res = 19;
                    break;
                case "二十":
                    res = 20;
                    break;
                default:
                    res = defaultValue;
                    break;
            }
        }
        return res.intValue();
    }
}
